//-------------------------------------------------------------------
//	Copyright (c) 2010-2014  Zhirnov Andrey
//	This file is part of the "UX Standard Lib" project.
//	See copyright notice in "UX_STL_Core.h".
//-------------------------------------------------------------------
/*
	test application
*/

package uxstl.test.app;

import android.util.Log;

//
// Activity
//

public class MainActivity	extends android.app.Activity
{
	static {
		System.loadLibrary("UXSTL");
	}
	
	
// constants //
	private static final String		TAG = "UXSTL-Test";
	
	
// variables //
	private boolean		runTests = true;
	

// Activity //

	// onCreate
	@Override protected
	void onCreate (android.os.Bundle savedInstanceState)
	{
		super.onCreate( savedInstanceState );
	}
	
	// onResume
	@Override
	protected void onResume ()
	{
		super.onResume();
		
		if ( runTests )
		{
			runTests = false;
			RunTests();
		}
	}
	
	
// Tests //
	
	public static final class TestClass
	{
		float f;
		
		TestClass ()
		{
			this.f = 0.0f;
		}
		
		TestClass (float f)
		{
			this.f = f;
		}
		
		TestClass (int a, int b)
		{
			this.f = a * 1.0e+6f + (float)b;
		}
		
		public void Print (int a)
		{
			Log.e( TAG, "TestClass::Pring : " + f + " " + a );
		}
		
		public TestClass Self (TestClass obj)
		{
			if (obj == this)
				return this;
			
			return obj;
		}
	}
	
	private static native void RunNativeTests (String internalStorage);
	
	
	// RunTests
	private final void RunTests ()
	{
		Log.i( TAG, "RunTests" );
		
		RunNativeTests( this.getFilesDir().getAbsolutePath() );
		
		// TODO: add tests
	}
}
